package com.gxl.butt.DAO.impl;

import com.gxl.butt.DAO.ICountUserDAO;
import com.gxl.butt.domain.CountUser;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by GUOXIAOLIN on 2018/7/13.
 */
@Repository
public class CountUserDAOImpl extends HibernateBaseDao<CountUser> implements ICountUserDAO {

    @Override
    public List<CountUser> getCountUserByUserid(Long userid) {
        String hql = "from " + CountUser.class.getName() + " do where do.userid = " + userid;
        List<CountUser>  countUsers = this.getListByHql(hql);
        if (countUsers != null && countUsers.size() > 0){
            return countUsers;
        }
        return null;
    }

    @Override
    public Long saveCountUser(CountUser user) {
        return (Long) this.save(user);
    }

    @Override
    public void updateCountUser(CountUser user) {

        this.update(user);

    }

}
